package model;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class Booking {
	private String first;
	private String last;
	private Event event;
	
	public Booking(String first, String last, Event event){
		
		this.first = first;
		this.last = last;
		this.event = event;
	}
	
	public String toFile(){
		return first + " " + last + " " + event;
	}
	public void save(){
		try {
			  // Create file 
			  FileWriter fstream = new FileWriter("src\\data\\bookings\\"+event.getID(),true);//add true to append
			  BufferedWriter out1 = new BufferedWriter(fstream);
			  out1.write(toFile()+"\n");
			  //Close the output stream
			  out1.close();
		} 
		catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static void load(){
		
	}
}
